home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Night Owl 6
/
Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso
/
027a
/
dgeclc.zip
/
CIRCLE.C
< prev
next >
Wrap
Text File
|
1991-05-20
|
2KB
|
92 lines
#include "c:\clipper\include\extend.h"
#include <math.h>
typedef int (*PFI)();
int DGEMAINVGA(); /* dGE drivers */
int DGEMAINCGM();
int DGEMAINHRC();
int dgenul(); /* NUL driver */
int rval, stlen=0;
char *st=0;
PFI dgemgen[] =
{
DGEMAINHRC,
DGEMAINCGM,
dgenul,
DGEMAINVGA,
DGEMAINVGA,
};
double dgeatof();
int dgedid = 0;
int dgeut = -1;
int dgenul()
{ return 6; }
int boxfill(int a,int b,int c,int d,int e,int f)
{
return (*dgemgen[dgedid])(st,stlen,0,0,f,e,d,c,b,a, 9);
}
int dgeinst()
{
int i;
for(i = 4 ; i >=0 ; i--) /* dummy call to datareset */
{ rval = (*dgemgen[i])(st,stlen,0,0,0,0,0,0,0,0, 19);
if(rval != 6) {dgedid = i; dgeut = 0; break; } }
return (rval);
}
/*
*****
* CIRCLE.PRG
*
* Date: 12/02/90
* Written by: Peter M. Freese
* Pinnacle Publishing, Inc.
*
* This program demonstrates a circle routine that allows you to draw filled
* circles on top of other screen objects in dGE. Circles drawn with dGE's
* DRAWCIRCLE() function cannot be filled unless the circle is drawn on a
* blank screen region, since they are filled with the SHADE() function.
* The CIRCLE() routine presented here allows circles to be drawn over other
* image data, and fill somewhat faster than the DRAWCIRCLE() function.
*
* Compile with /c /AL /FPa
*
*/
CLIPPER circle()
{
int x,y,r,c;
int y0 = 1, x0 = 2;
long r2;
x = _parni(1);
y = _parni(2);
r = _parni(3);
c = _parni(4);
if (dgeut) dgeinst(); /* set up dGE drivers */
r2 = (long)r*r;
while(y0 < r)
{
x0 = (int)sqrt((float)(r2-(long)y0*y0));
boxfill(x-x0,y-y0,x0+x0,1,128,c);
boxfill(x-x0,y+y0,x0+x0,1,128,c);
y0 += 3;
/* skip virtual rows to save time */
}
}